<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
      <title>Class ColorUtil | HiAPI-C# 2025 </title>
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta name="title" content="Class ColorUtil | HiAPI-C# 2025 ">
      
      <meta name="description" content="Utility for handling color. Includes handle of RGB and HSL.">
      <link rel="icon" href="../img/HiAPI.favicon.ico">
      <link rel="stylesheet" href="../public/docfx.min.css">
      <link rel="stylesheet" href="../public/main.css">
      <meta name="docfx:navrel" content="../toc.html">
      <meta name="docfx:tocrel" content="toc.html">
      
      <meta name="docfx:rel" content="../">
      
      
      
      <meta name="loc:inThisArticle" content="In this article">
      <meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
      <meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
      <meta name="loc:tocFilter" content="Filter by title">
      <meta name="loc:nextArticle" content="Next">
      <meta name="loc:prevArticle" content="Previous">
      <meta name="loc:themeLight" content="Light">
      <meta name="loc:themeDark" content="Dark">
      <meta name="loc:themeAuto" content="Auto">
      <meta name="loc:changeTheme" content="Change theme">
      <meta name="loc:copy" content="Copy">
      <meta name="loc:downloadPdf" content="Download PDF">

      <script type="module" src="./../public/docfx.min.js"></script>

      <script>
        const theme = localStorage.getItem('theme') || 'auto'
        document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
      </script>

  </head>

  <body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference">
    <header class="bg-body border-bottom">
      <nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
        <div class="container-xxl flex-nowrap">
          <a class="navbar-brand" href="../index.html">
            <img id="logo" class="svg" src="../img/HiAPI.logo.png" alt="">
            
          </a>
          <button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
            <i class="bi bi-three-dots"></i>
          </button>
          <div class="collapse navbar-collapse" id="navpanel">
            <div id="navbar">
              <form class="search" role="search" id="search">
                <i class="bi bi-search"></i>
                <input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
              </form>
            </div>
          </div>
        </div>
      </nav>
    </header>

    <main class="container-xxl">
      <div class="toc-offcanvas">
        <div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
          <div class="offcanvas-header">
            <h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
            <button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
          </div>
          <div class="offcanvas-body">
            <nav class="toc" id="toc"></nav>
          </div>
        </div>
      </div>

      <div class="content">
        <div class="actionbar">
          <button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
            <i class="bi bi-list"></i>
          </button>

          <nav id="breadcrumb"></nav>
        </div>

        <article data-uid="Hi.Coloring.ColorUtil">



  <h1 id="Hi_Coloring_ColorUtil" data-uid="Hi.Coloring.ColorUtil" class="text-break">
Class ColorUtil  
  </h1>

  <div class="facts text-secondary">
    <dl><dt>Namespace</dt><dd><a class="xref" href="Hi.html">Hi</a>.<a class="xref" href="Hi.Coloring.html">Coloring</a></dd></dl>
  <dl><dt>Assembly</dt><dd>HiGeom.dll</dd></dl>
  </div>

  <div class="markdown summary"><p>Utility for handling color. Includes handle of RGB and HSL.</p>
</div>
  <div class="markdown conceptual"></div>

  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public static class ColorUtil</code></pre>
  </div>




  <dl class="typelist inheritance">
    <dt>Inheritance</dt>
    <dd>
      <div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
      <div><span class="xref">ColorUtil</span></div>
    </dd>
  </dl>



  <dl class="typelist inheritedMembers">
    <dt>Inherited Members</dt>
    <dd>
    <div>
      <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object)</a>
    </div>
    <div>
      <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object, object)</a>
    </div>
    <div>
      <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a>
    </div>
    <div>
      <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>
    </div>
    <div>
      <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>
    </div>
    <div>
      <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object, object)</a>
    </div>
    <div>
      <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>
    </div>
  </dd></dl>






  <h2 class="section" id="properties">Properties
</h2>


  <a id="Hi_Coloring_ColorUtil_EnvDiscreteRgbSeed_" data-uid="Hi.Coloring.ColorUtil.EnvDiscreteRgbSeed*"></a>

  <h3 id="Hi_Coloring_ColorUtil_EnvDiscreteRgbSeed" data-uid="Hi.Coloring.ColorUtil.EnvDiscreteRgbSeed">
  EnvDiscreteRgbSeed
  
  </h3>

  <div class="markdown level1 summary"></div>
  <div class="markdown level1 conceptual"></div>

  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public static int EnvDiscreteRgbSeed { get; set; }</code></pre>
  </div>





  <h4 class="section">Property Value</h4>
  <dl class="parameters">
    <dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
    <dd><p>The seed is applied to <a class="xref" href="Hi.Coloring.ColorUtil.html#Hi_Coloring_ColorUtil_GetDiscreteRGB_Env_System_Double_System_Double_">GetDiscreteRGB_Env(double, double)</a>.</p>
</dd>
  </dl>








  <a id="Hi_Coloring_ColorUtil_ExceptionRed_" data-uid="Hi.Coloring.ColorUtil.ExceptionRed*"></a>

  <h3 id="Hi_Coloring_ColorUtil_ExceptionRed" data-uid="Hi.Coloring.ColorUtil.ExceptionRed">
  ExceptionRed
  
  </h3>

  <div class="markdown level1 summary"><p>Exception RGB. Also for nan value.</p>
</div>
  <div class="markdown level1 conceptual"></div>

  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public static Vec3d ExceptionRed { get; }</code></pre>
  </div>





  <h4 class="section">Property Value</h4>
  <dl class="parameters">
    <dt><a class="xref" href="Hi.Geom.Vec3d.html">Vec3d</a></dt>
    <dd></dd>
  </dl>








  <a id="Hi_Coloring_ColorUtil_Gray_" data-uid="Hi.Coloring.ColorUtil.Gray*"></a>

  <h3 id="Hi_Coloring_ColorUtil_Gray" data-uid="Hi.Coloring.ColorUtil.Gray">
  Gray
  
  </h3>

  <div class="markdown level1 summary"><p>Generate gray color. RGB=(0.2, 0.2, 0.2).</p>
</div>
  <div class="markdown level1 conceptual"></div>

  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public static Vec3d Gray { get; }</code></pre>
  </div>





  <h4 class="section">Property Value</h4>
  <dl class="parameters">
    <dt><a class="xref" href="Hi.Geom.Vec3d.html">Vec3d</a></dt>
    <dd></dd>
  </dl>








  <a id="Hi_Coloring_ColorUtil_NoValueGreen_" data-uid="Hi.Coloring.ColorUtil.NoValueGreen*"></a>

  <h3 id="Hi_Coloring_ColorUtil_NoValueGreen" data-uid="Hi.Coloring.ColorUtil.NoValueGreen">
  NoValueGreen
  
  </h3>

  <div class="markdown level1 summary"><p>No value RGB.</p>
</div>
  <div class="markdown level1 conceptual"></div>

  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public static Vec3d NoValueGreen { get; }</code></pre>
  </div>





  <h4 class="section">Property Value</h4>
  <dl class="parameters">
    <dt><a class="xref" href="Hi.Geom.Vec3d.html">Vec3d</a></dt>
    <dd></dd>
  </dl>








  <a id="Hi_Coloring_ColorUtil_NullDark_" data-uid="Hi.Coloring.ColorUtil.NullDark*"></a>

  <h3 id="Hi_Coloring_ColorUtil_NullDark" data-uid="Hi.Coloring.ColorUtil.NullDark">
  NullDark
  
  </h3>

  <div class="markdown level1 summary"><p>Generate dark RGB for null value. RGB=(0,0,0).</p>
</div>
  <div class="markdown level1 conceptual"></div>

  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public static Vec3d NullDark { get; }</code></pre>
  </div>





  <h4 class="section">Property Value</h4>
  <dl class="parameters">
    <dt><a class="xref" href="Hi.Geom.Vec3d.html">Vec3d</a></dt>
    <dd></dd>
  </dl>








  <a id="Hi_Coloring_ColorUtil_UndeterminedPurple_" data-uid="Hi.Coloring.ColorUtil.UndeterminedPurple*"></a>

  <h3 id="Hi_Coloring_ColorUtil_UndeterminedPurple" data-uid="Hi.Coloring.ColorUtil.UndeterminedPurple">
  UndeterminedPurple
  
  </h3>

  <div class="markdown level1 summary"><p>Undetermined RGB.</p>
</div>
  <div class="markdown level1 conceptual"></div>

  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public static Vec3d UndeterminedPurple { get; }</code></pre>
  </div>





  <h4 class="section">Property Value</h4>
  <dl class="parameters">
    <dt><a class="xref" href="Hi.Geom.Vec3d.html">Vec3d</a></dt>
    <dd></dd>
  </dl>








  <h2 class="section" id="methods">Methods
</h2>


  <a id="Hi_Coloring_ColorUtil_GetDiscreteRGBWithoutPurpleAndRed_" data-uid="Hi.Coloring.ColorUtil.GetDiscreteRGBWithoutPurpleAndRed*"></a>

  <h3 id="Hi_Coloring_ColorUtil_GetDiscreteRGBWithoutPurpleAndRed_System_Int32_System_Double_System_Double_" data-uid="Hi.Coloring.ColorUtil.GetDiscreteRGBWithoutPurpleAndRed(System.Int32,System.Double,System.Double)">
  GetDiscreteRGBWithoutPurpleAndRed(int, double, double)
  
  </h3>

  <div class="markdown level1 summary"><p>Get discrete RGB without purple and red color ranges.</p>
</div>
  <div class="markdown level1 conceptual"></div>

  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public static Vec3d GetDiscreteRGBWithoutPurpleAndRed(int seed, double saturation = 1, double light = 0.5)</code></pre>
  </div>

  <h4 class="section">Parameters</h4>
  <dl class="parameters">
    <dt><code>seed</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
    <dd><p>Color seed. Determines the hue value.</p>
</dd>
    <dt><code>saturation</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
    <dd><p>Saturation value of the color.</p>
</dd>
    <dt><code>light</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
    <dd><p>Light value of the color.</p>
</dd>
  </dl>

  <h4 class="section">Returns</h4>
  <dl class="parameters">
    <dt><a class="xref" href="Hi.Geom.Vec3d.html">Vec3d</a></dt>
    <dd><p>RGB color vector without purple and red ranges.</p>
</dd>
  </dl>











  <a id="Hi_Coloring_ColorUtil_GetDiscreteRGB_Env_" data-uid="Hi.Coloring.ColorUtil.GetDiscreteRGB_Env*"></a>

  <h3 id="Hi_Coloring_ColorUtil_GetDiscreteRGB_Env_System_Double_System_Double_" data-uid="Hi.Coloring.ColorUtil.GetDiscreteRGB_Env(System.Double,System.Double)">
  GetDiscreteRGB_Env(double, double)
  
  </h3>

  <div class="markdown level1 summary"><p>Get discrete color using <a class="xref" href="Hi.Coloring.ColorUtil.html#Hi_Coloring_ColorUtil_EnvDiscreteRgbSeed">EnvDiscreteRgbSeed</a>.
The functionality is the same as <a class="xref" href="Hi.Coloring.ColorUtil.html#Hi_Coloring_ColorUtil_GetDiscreteRgb_System_Int32_System_Double_System_Double_">GetDiscreteRgb(int, double, double)</a>.
The function call makes <a class="xref" href="Hi.Coloring.ColorUtil.html#Hi_Coloring_ColorUtil_EnvDiscreteRgbSeed">EnvDiscreteRgbSeed</a> plus 1.</p>
</div>
  <div class="markdown level1 conceptual"></div>

  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public static Vec3d GetDiscreteRGB_Env(double saturation = 1, double light = 0.5)</code></pre>
  </div>

  <h4 class="section">Parameters</h4>
  <dl class="parameters">
    <dt><code>saturation</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
    <dd><p>saturation</p>
</dd>
    <dt><code>light</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
    <dd><p>light</p>
</dd>
  </dl>

  <h4 class="section">Returns</h4>
  <dl class="parameters">
    <dt><a class="xref" href="Hi.Geom.Vec3d.html">Vec3d</a></dt>
    <dd><p>RGB</p>
</dd>
  </dl>











  <a id="Hi_Coloring_ColorUtil_GetDiscreteRgb_" data-uid="Hi.Coloring.ColorUtil.GetDiscreteRgb*"></a>

  <h3 id="Hi_Coloring_ColorUtil_GetDiscreteRgb_System_Int32_System_Double_System_Double_" data-uid="Hi.Coloring.ColorUtil.GetDiscreteRgb(System.Int32,System.Double,System.Double)">
  GetDiscreteRgb(int, double, double)
  
  </h3>

  <div class="markdown level1 summary"><p>Get discrete color(RGB).
The term &lsquo;discrete&rsquo; means there is big color difference between nearby seed.
This function is good to auto set color for lot of components.</p>
</div>
  <div class="markdown level1 conceptual"></div>

  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public static Vec3d GetDiscreteRgb(int seed, double saturation = 1, double light = 0.5)</code></pre>
  </div>

  <h4 class="section">Parameters</h4>
  <dl class="parameters">
    <dt><code>seed</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
    <dd><p>color seed. Determine the hue value by <a class="xref" href="Hi.Geom.MathUtil.html#Hi_Geom_MathUtil_BinaryDividentSequence_System_Int32_">BinaryDividentSequence(int)</a>.</p>
</dd>
    <dt><code>saturation</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
    <dd><p>saturation</p>
</dd>
    <dt><code>light</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
    <dd><p>light</p>
</dd>
  </dl>

  <h4 class="section">Returns</h4>
  <dl class="parameters">
    <dt><a class="xref" href="Hi.Geom.Vec3d.html">Vec3d</a></dt>
    <dd><p>RGB</p>
</dd>
  </dl>











  <a id="Hi_Coloring_ColorUtil_GetDiscreteRgbByBoundary_" data-uid="Hi.Coloring.ColorUtil.GetDiscreteRgbByBoundary*"></a>

  <h3 id="Hi_Coloring_ColorUtil_GetDiscreteRgbByBoundary_System_Int32_System_Double_System_Double_System_Double_System_Double_" data-uid="Hi.Coloring.ColorUtil.GetDiscreteRgbByBoundary(System.Int32,System.Double,System.Double,System.Double,System.Double)">
  GetDiscreteRgbByBoundary(int, double, double, double, double)
  
  </h3>

  <div class="markdown level1 summary"><p>Get discrete RGB by boundary.</p>
</div>
  <div class="markdown level1 conceptual"></div>

  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public static Vec3d GetDiscreteRgbByBoundary(int seed, double hueBegin = 0, double hueEnd = 1, double saturation = 1, double light = 0.5)</code></pre>
  </div>

  <h4 class="section">Parameters</h4>
  <dl class="parameters">
    <dt><code>seed</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
    <dd><p>Color seed. Determines the hue value.</p>
</dd>
    <dt><code>hueBegin</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
    <dd><p>The beginning of the hue range.</p>
</dd>
    <dt><code>hueEnd</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
    <dd><p>The end of the hue range.</p>
</dd>
    <dt><code>saturation</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
    <dd><p>Saturation value of the color.</p>
</dd>
    <dt><code>light</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
    <dd><p>Light value of the color.</p>
</dd>
  </dl>

  <h4 class="section">Returns</h4>
  <dl class="parameters">
    <dt><a class="xref" href="Hi.Geom.Vec3d.html">Vec3d</a></dt>
    <dd><p>RGB color vector with boundary.</p>
</dd>
  </dl>











  <a id="Hi_Coloring_ColorUtil_GetGloomyColor_" data-uid="Hi.Coloring.ColorUtil.GetGloomyColor*"></a>

  <h3 id="Hi_Coloring_ColorUtil_GetGloomyColor_System_Object_System_Double_System_Double_" data-uid="Hi.Coloring.ColorUtil.GetGloomyColor(System.Object,System.Double,System.Double)">
  GetGloomyColor(object, double, double)
  
  </h3>

  <div class="markdown level1 summary"><p>The default value is blue tune.</p>
</div>
  <div class="markdown level1 conceptual"></div>

  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public static Vec3d GetGloomyColor(this object seed, double hueMin = 0.5, double hueMax = 0.7)</code></pre>
  </div>

  <h4 class="section">Parameters</h4>
  <dl class="parameters">
    <dt><code>seed</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></dt>
    <dd></dd>
    <dt><code>hueMin</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
    <dd></dd>
    <dt><code>hueMax</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
    <dd></dd>
  </dl>

  <h4 class="section">Returns</h4>
  <dl class="parameters">
    <dt><a class="xref" href="Hi.Geom.Vec3d.html">Vec3d</a></dt>
    <dd></dd>
  </dl>











  <a id="Hi_Coloring_ColorUtil_GetRgb_" data-uid="Hi.Coloring.ColorUtil.GetRgb*"></a>

  <h3 id="Hi_Coloring_ColorUtil_GetRgb_System_Double_Hi_Coloring_RatioRgbFuncEnum_" data-uid="Hi.Coloring.ColorUtil.GetRgb(System.Double,Hi.Coloring.RatioRgbFuncEnum)">
  GetRgb(double, RatioRgbFuncEnum)
  
  </h3>

  <div class="markdown level1 summary"><p>Get RGB by <code class="paramref">funcEnum</code>.</p>
</div>
  <div class="markdown level1 conceptual"></div>

  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public static Vec3d GetRgb(double v, RatioRgbFuncEnum funcEnum)</code></pre>
  </div>

  <h4 class="section">Parameters</h4>
  <dl class="parameters">
    <dt><code>v</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
    <dd><p>value</p>
</dd>
    <dt><code>funcEnum</code> <a class="xref" href="Hi.Coloring.RatioRgbFuncEnum.html">RatioRgbFuncEnum</a></dt>
    <dd><p>function enum</p>
</dd>
  </dl>

  <h4 class="section">Returns</h4>
  <dl class="parameters">
    <dt><a class="xref" href="Hi.Geom.Vec3d.html">Vec3d</a></dt>
    <dd><p>RGB</p>
</dd>
  </dl>











  <a id="Hi_Coloring_ColorUtil_GetRgbByErf_" data-uid="Hi.Coloring.ColorUtil.GetRgbByErf*"></a>

  <h3 id="Hi_Coloring_ColorUtil_GetRgbByErf_System_Double_" data-uid="Hi.Coloring.ColorUtil.GetRgbByErf(System.Double)">
  GetRgbByErf(double)
  
  </h3>

  <div class="markdown level1 summary"><p>Get RGB interpolated from blue to green to red by erf function.
The range suits for -2 to 0 to 2.</p>
</div>
  <div class="markdown level1 conceptual"></div>

  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public static Vec3d GetRgbByErf(double v)</code></pre>
  </div>

  <h4 class="section">Parameters</h4>
  <dl class="parameters">
    <dt><code>v</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
    <dd><p>input of the erf</p>
</dd>
  </dl>

  <h4 class="section">Returns</h4>
  <dl class="parameters">
    <dt><a class="xref" href="Hi.Geom.Vec3d.html">Vec3d</a></dt>
    <dd><p>RGB</p>
</dd>
  </dl>











  <a id="Hi_Coloring_ColorUtil_GetRgbByHslOffset_" data-uid="Hi.Coloring.ColorUtil.GetRgbByHslOffset*"></a>

  <h3 id="Hi_Coloring_ColorUtil_GetRgbByHslOffset_Hi_Geom_Vec3d_Hi_Geom_Vec3d_" data-uid="Hi.Coloring.ColorUtil.GetRgbByHslOffset(Hi.Geom.Vec3d,Hi.Geom.Vec3d)">
  GetRgbByHslOffset(Vec3d, Vec3d)
  
  </h3>

  <div class="markdown level1 summary"><p>Convert RGB by HSL offset.
This is a three step process: RGB convert to HSL, HSL+=<code class="paramref">hslOffset</code>, HSL convert to RGB.</p>
</div>
  <div class="markdown level1 conceptual"></div>

  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public static Vec3d GetRgbByHslOffset(Vec3d rgb, Vec3d hslOffset)</code></pre>
  </div>

  <h4 class="section">Parameters</h4>
  <dl class="parameters">
    <dt><code>rgb</code> <a class="xref" href="Hi.Geom.Vec3d.html">Vec3d</a></dt>
    <dd><p>RGB</p>
</dd>
    <dt><code>hslOffset</code> <a class="xref" href="Hi.Geom.Vec3d.html">Vec3d</a></dt>
    <dd><p>HSL offset</p>
</dd>
  </dl>

  <h4 class="section">Returns</h4>
  <dl class="parameters">
    <dt><a class="xref" href="Hi.Geom.Vec3d.html">Vec3d</a></dt>
    <dd><p>RGB</p>
</dd>
  </dl>











  <a id="Hi_Coloring_ColorUtil_GetRgbByLinearRatio_" data-uid="Hi.Coloring.ColorUtil.GetRgbByLinearRatio*"></a>

  <h3 id="Hi_Coloring_ColorUtil_GetRgbByLinearRatio_System_Double_" data-uid="Hi.Coloring.ColorUtil.GetRgbByLinearRatio(System.Double)">
  GetRgbByLinearRatio(double)
  
  </h3>

  <div class="markdown level1 summary"><p>0 ~ 0.5 ~ 1 is linearly interpolated to blue to green to red.
The below range data is pure blue. The exceeding range data is pure red.</p>
</div>
  <div class="markdown level1 conceptual"></div>

  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public static Vec3d GetRgbByLinearRatio(double ratio)</code></pre>
  </div>

  <h4 class="section">Parameters</h4>
  <dl class="parameters">
    <dt><code>ratio</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
    <dd><p>the interpolation range is 0~1</p>
</dd>
  </dl>

  <h4 class="section">Returns</h4>
  <dl class="parameters">
    <dt><a class="xref" href="Hi.Geom.Vec3d.html">Vec3d</a></dt>
    <dd><p>RGB</p>
</dd>
  </dl>











  <a id="Hi_Coloring_ColorUtil_GetRgbByNormalizedErf_" data-uid="Hi.Coloring.ColorUtil.GetRgbByNormalizedErf*"></a>

  <h3 id="Hi_Coloring_ColorUtil_GetRgbByNormalizedErf_System_Double_" data-uid="Hi.Coloring.ColorUtil.GetRgbByNormalizedErf(System.Double)">
  GetRgbByNormalizedErf(double)
  
  </h3>

  <div class="markdown level1 summary"><p>0 ~ 0.5 ~ 1 is interpolated to blue to green to red.
The below range data is pure blue. The exceeding range data is pure red.
<code>return GetRgbByLinearRatio(MathUtil.Erf(ratio*2) / MathUtil.Erf(2));</code></p>
</div>
  <div class="markdown level1 conceptual"></div>

  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public static Vec3d GetRgbByNormalizedErf(double ratio)</code></pre>
  </div>

  <h4 class="section">Parameters</h4>
  <dl class="parameters">
    <dt><code>ratio</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
    <dd><p>the interpolation range is 0~1</p>
</dd>
  </dl>

  <h4 class="section">Returns</h4>
  <dl class="parameters">
    <dt><a class="xref" href="Hi.Geom.Vec3d.html">Vec3d</a></dt>
    <dd><p>RGB</p>
</dd>
  </dl>











  <a id="Hi_Coloring_ColorUtil_GetRgbByNormalizedPositiveErf_" data-uid="Hi.Coloring.ColorUtil.GetRgbByNormalizedPositiveErf*"></a>

  <h3 id="Hi_Coloring_ColorUtil_GetRgbByNormalizedPositiveErf_System_Double_" data-uid="Hi.Coloring.ColorUtil.GetRgbByNormalizedPositiveErf(System.Double)">
  GetRgbByNormalizedPositiveErf(double)
  
  </h3>

  <div class="markdown level1 summary"><p>0 ~ 0.5 ~ 1 is interpolated to blue to green to red.
The below range data is pure blue. The exceeding range data is pure red.
Only the positive half form is used.
<code>return GetRgbByLinearRatio(MathUtil.Erf(ratio*2) / MathUtil.Erf(2));</code></p>
</div>
  <div class="markdown level1 conceptual"></div>

  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public static Vec3d GetRgbByNormalizedPositiveErf(double ratio)</code></pre>
  </div>

  <h4 class="section">Parameters</h4>
  <dl class="parameters">
    <dt><code>ratio</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
    <dd><p>the interpolation range is 0~1</p>
</dd>
  </dl>

  <h4 class="section">Returns</h4>
  <dl class="parameters">
    <dt><a class="xref" href="Hi.Geom.Vec3d.html">Vec3d</a></dt>
    <dd><p>RGB</p>
</dd>
  </dl>











  <a id="Hi_Coloring_ColorUtil_GetRgbByPositiveErf_" data-uid="Hi.Coloring.ColorUtil.GetRgbByPositiveErf*"></a>

  <h3 id="Hi_Coloring_ColorUtil_GetRgbByPositiveErf_System_Double_" data-uid="Hi.Coloring.ColorUtil.GetRgbByPositiveErf(System.Double)">
  GetRgbByPositiveErf(double)
  
  </h3>

  <div class="markdown level1 summary"><p>Get RGB interpolated from blue to green to red by modified erf function.</p>
</div>
  <div class="markdown level1 conceptual"></div>

  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public static Vec3d GetRgbByPositiveErf(double v)</code></pre>
  </div>

  <h4 class="section">Parameters</h4>
  <dl class="parameters">
    <dt><code>v</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
    <dd><p>input of the modified erf</p>
</dd>
  </dl>

  <h4 class="section">Returns</h4>
  <dl class="parameters">
    <dt><a class="xref" href="Hi.Geom.Vec3d.html">Vec3d</a></dt>
    <dd><p>color</p>
</dd>
  </dl>







  <h4 class="section" id="Hi_Coloring_ColorUtil_GetRgbByPositiveErf_System_Double__remarks">Remarks</h4>
  <div class="markdown level1 remarks"><p>If <code class="paramref">v</code> is equal or lower than 0, the color is blue;
if <code class="paramref">v</code> is equal or larger than 1, the color is red;
otherwise, the color varied from blue to green to red by modified erf function.</p>
</div>




  <a id="Hi_Coloring_ColorUtil_GetRgbByPositiveErf_" data-uid="Hi.Coloring.ColorUtil.GetRgbByPositiveErf*"></a>

  <h3 id="Hi_Coloring_ColorUtil_GetRgbByPositiveErf_System_Double_System_Double_System_Double_" data-uid="Hi.Coloring.ColorUtil.GetRgbByPositiveErf(System.Double,System.Double,System.Double)">
  GetRgbByPositiveErf(double, double, double)
  
  </h3>

  <div class="markdown level1 summary"><p>Get RGB interpolated from blue to green to red by modified erf function.</p>
</div>
  <div class="markdown level1 conceptual"></div>

  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public static Vec3d GetRgbByPositiveErf(double v, double floor, double ceil)</code></pre>
  </div>

  <h4 class="section">Parameters</h4>
  <dl class="parameters">
    <dt><code>v</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
    <dd><p>input of the modified erf</p>
</dd>
    <dt><code>floor</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
    <dd><p>floor value of v</p>
</dd>
    <dt><code>ceil</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
    <dd><p>ceil value of v</p>
</dd>
  </dl>

  <h4 class="section">Returns</h4>
  <dl class="parameters">
    <dt><a class="xref" href="Hi.Geom.Vec3d.html">Vec3d</a></dt>
    <dd><p>color</p>
</dd>
  </dl>







  <h4 class="section" id="Hi_Coloring_ColorUtil_GetRgbByPositiveErf_System_Double_System_Double_System_Double__remarks">Remarks</h4>
  <div class="markdown level1 remarks"><p>If <code class="paramref">v</code> is equal or lower than <code class="paramref">floor</code>, the color is blue;
if <code class="paramref">v</code> is equal or larger than <code class="paramref">ceil</code>, the color is red;
otherwise, the color varied from blue to green to red by modified erf function.</p>
</div>




  <a id="Hi_Coloring_ColorUtil_HslToRgb_" data-uid="Hi.Coloring.ColorUtil.HslToRgb*"></a>

  <h3 id="Hi_Coloring_ColorUtil_HslToRgb_Hi_Geom_Vec3d_" data-uid="Hi.Coloring.ColorUtil.HslToRgb(Hi.Geom.Vec3d)">
  HslToRgb(Vec3d)
  
  </h3>

  <div class="markdown level1 summary"><p>Convert color convention from HSL to RGB.</p>
</div>
  <div class="markdown level1 conceptual"></div>

  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public static Vec3d HslToRgb(Vec3d hsl)</code></pre>
  </div>

  <h4 class="section">Parameters</h4>
  <dl class="parameters">
    <dt><code>hsl</code> <a class="xref" href="Hi.Geom.Vec3d.html">Vec3d</a></dt>
    <dd><p>HSL</p>
</dd>
  </dl>

  <h4 class="section">Returns</h4>
  <dl class="parameters">
    <dt><a class="xref" href="Hi.Geom.Vec3d.html">Vec3d</a></dt>
    <dd><p>RGB</p>
</dd>
  </dl>











  <a id="Hi_Coloring_ColorUtil_HslToRgb_" data-uid="Hi.Coloring.ColorUtil.HslToRgb*"></a>

  <h3 id="Hi_Coloring_ColorUtil_HslToRgb_System_Double_System_Double_System_Double_" data-uid="Hi.Coloring.ColorUtil.HslToRgb(System.Double,System.Double,System.Double)">
  HslToRgb(double, double, double)
  
  </h3>

  <div class="markdown level1 summary"><p>Convert color convention from HSL to RGB.</p>
</div>
  <div class="markdown level1 conceptual"></div>

  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public static Vec3d HslToRgb(double hue, double saturation, double light)</code></pre>
  </div>

  <h4 class="section">Parameters</h4>
  <dl class="parameters">
    <dt><code>hue</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
    <dd><p>hue</p>
</dd>
    <dt><code>saturation</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
    <dd><p>saturation</p>
</dd>
    <dt><code>light</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
    <dd><p>light</p>
</dd>
  </dl>

  <h4 class="section">Returns</h4>
  <dl class="parameters">
    <dt><a class="xref" href="Hi.Geom.Vec3d.html">Vec3d</a></dt>
    <dd><p>RGB</p>
</dd>
  </dl>











  <a id="Hi_Coloring_ColorUtil_RgbToHsl_" data-uid="Hi.Coloring.ColorUtil.RgbToHsl*"></a>

  <h3 id="Hi_Coloring_ColorUtil_RgbToHsl_Hi_Geom_Vec3d_" data-uid="Hi.Coloring.ColorUtil.RgbToHsl(Hi.Geom.Vec3d)">
  RgbToHsl(Vec3d)
  
  </h3>

  <div class="markdown level1 summary"><p>Convert color convention from RGB to HSL.</p>
</div>
  <div class="markdown level1 conceptual"></div>

  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public static Vec3d RgbToHsl(Vec3d rgb)</code></pre>
  </div>

  <h4 class="section">Parameters</h4>
  <dl class="parameters">
    <dt><code>rgb</code> <a class="xref" href="Hi.Geom.Vec3d.html">Vec3d</a></dt>
    <dd><p>RGB</p>
</dd>
  </dl>

  <h4 class="section">Returns</h4>
  <dl class="parameters">
    <dt><a class="xref" href="Hi.Geom.Vec3d.html">Vec3d</a></dt>
    <dd><p>HSL</p>
</dd>
  </dl>











  <a id="Hi_Coloring_ColorUtil_RgbToHsl_" data-uid="Hi.Coloring.ColorUtil.RgbToHsl*"></a>

  <h3 id="Hi_Coloring_ColorUtil_RgbToHsl_System_Double_System_Double_System_Double_" data-uid="Hi.Coloring.ColorUtil.RgbToHsl(System.Double,System.Double,System.Double)">
  RgbToHsl(double, double, double)
  
  </h3>

  <div class="markdown level1 summary"><p>Convert color convention from RGB to HSL.</p>
</div>
  <div class="markdown level1 conceptual"></div>

  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public static Vec3d RgbToHsl(double r, double g, double b)</code></pre>
  </div>

  <h4 class="section">Parameters</h4>
  <dl class="parameters">
    <dt><code>r</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
    <dd><p>red</p>
</dd>
    <dt><code>g</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
    <dd><p>green</p>
</dd>
    <dt><code>b</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
    <dd><p>blue</p>
</dd>
  </dl>

  <h4 class="section">Returns</h4>
  <dl class="parameters">
    <dt><a class="xref" href="Hi.Geom.Vec3d.html">Vec3d</a></dt>
    <dd><p>HSL</p>
</dd>
  </dl>











  <a id="Hi_Coloring_ColorUtil_ToDualHexString_" data-uid="Hi.Coloring.ColorUtil.ToDualHexString*"></a>

  <h3 id="Hi_Coloring_ColorUtil_ToDualHexString_Hi_Geom_Vec3d_" data-uid="Hi.Coloring.ColorUtil.ToDualHexString(Hi.Geom.Vec3d)">
  ToDualHexString(Vec3d)
  
  </h3>

  <div class="markdown level1 summary"><p>Converts an RGB color vector to a hexadecimal string representation.</p>
</div>
  <div class="markdown level1 conceptual"></div>

  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public static string ToDualHexString(Vec3d rgb)</code></pre>
  </div>

  <h4 class="section">Parameters</h4>
  <dl class="parameters">
    <dt><code>rgb</code> <a class="xref" href="Hi.Geom.Vec3d.html">Vec3d</a></dt>
    <dd><p>The RGB color vector to convert.</p>
</dd>
  </dl>

  <h4 class="section">Returns</h4>
  <dl class="parameters">
    <dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
    <dd><p>A hexadecimal string representation of the RGB color.</p>
</dd>
  </dl>












</article>

        <div class="contribution d-print-none">
        </div>


      </div>

      <div class="affix">
        <nav id="affix"></nav>
      </div>
    </main>

    <div class="container-xxl search-results" id="search-results"></div>

    <footer class="border-top text-secondary">
      <div class="container-xxl">
        <div class="flex-fill">
          <span> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
        </div>
      </div>
    </footer>
  </body>
</html>
